package controller;

import lombok.Data;
import services.IWordService;
import services.impl.WordService;
import utils.BaseAction;

@Data
public class WordAction extends BaseAction {
    private String title;
    private String context;

    public String send() {
        if ((title != null && !title.equals("")) && (context != null && context.equals(""))) {
            IWordService iWordService = new WordService();
            int row = iWordService.send(title, context);
            if (row > 0) {
                getMapRequest().put("title", title);
                getMapRequest().put("context", context);
                return SUCCESS;
            } else {
                getMapRequest().put("msg", "发帖失败,请<a href='word.jsp'>重新发送</a>");
                return ERROR;
            }
        } else {
            return null;
        }
    }

}
